<template>
    <div>
       <h1>姓名:{{info.name}}</h1>
       <h1>年龄:{{info.age}}</h1>
       <h1>兴趣:{{info.intest}}</h1>
    </div>
</template>

<script>
  import axios from 'axios'
    export default {
        name: "asyncData",
       data(){
         return{
           name:'hello world'
         }
       },
       async asyncData(){
          let {data} = await  axios.get('https://api.myjson.com/bins/qgb8g')
          return {info:data}
       }
      /* asyncData(){
          return axios.get('https://api.myjson.com/bins/qgb8g')
            .then((res)=>{
              return {info:res.data};//因为是在数据接收之前
            })
       }*/
    }
</script>

<style scoped>

</style>
